﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Rabbit.Logic;
using RabbitManage.Code;

namespace RabbitManage.UI
{
    public partial class ImageList : System.Web.UI.Page
    {
        protected List<string> list;
        protected string shopId;
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies[Constant.CookieName];
            shopId = cookie.Values[Constant.CookieUid];
            string dir = HttpContext.Current.Server.MapPath("../UploadSpace/" + shopId + "/");
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            //string[] files = Directory.GetFiles(dir);

            list=new List<string>();
            DirectoryInfo directoryInfo=new DirectoryInfo(dir);
            FileInfo[] fileInfos = directoryInfo.GetFiles();
            foreach (FileInfo fileInfo in fileInfos)
            {
                string name = fileInfo.Name;
                //string url = "/UploadSpace/" + shopId + "/" + name;
                list.Add(name);
            }




            //HttpCookie cookie = Request.Cookies[Constant.CookieName];
            //string shopId = cookie.Values[Constant.CookieUid];
            //list = RabbitUse.GetProductList(Db.Store, shopId);
            myRepeater.DataSource = list;
            myRepeater.DataBind();
        }
    }
}